package com.example.springbootautodemo;

import org.springframework.boot.CommandLineRunner;
import org.springframework.core.env.Environment;

import java.util.Objects;

@SuppressWarnings("unused")
class CustomCommandLineRunner implements CommandLineRunner {
    Environment env;
    public CustomCommandLineRunner(Environment env){
        this.env=env;
    }
    @Override
    public void run(String... args){
        System.out.println("实验二，利用Spring Boot自动装配特性实现动态注册组件");

        System.out.println("生成一个随机字符串: ".concat(Objects.requireNonNull(env.getProperty("random."))));
    }

}
